package com.it.service.impl;

import com.it.mapper.DDepartmentMapper;
import com.it.pojo.DDepartment;
import com.it.service.DDepartmentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DDepartmentServiceimpl implements DDepartmentService {
    @Resource
    DDepartmentMapper dDepartmentMapper;
    //查询所有
    @Override
    public List<DDepartment> DDepartmentQueryAll() {
        return dDepartmentMapper.selectQueryAll();
    }
    //根据id查询
    @Override
    public DDepartment DDepartmentById(Integer id) {
        return dDepartmentMapper.selectByPrimaryKey(id);
    }
    //根据科室名称查询
    @Override
    public List<DDepartment> DDepartmentLikeName(String name) {
        return dDepartmentMapper.selectLikeName(name);
    }
    //新增科室
    @Override
    public int addDDepartment(DDepartment dDepartment) {
        return dDepartmentMapper.insertSelective(dDepartment);
    }
    //修改科室
    @Override
    public int updateDDepartment(DDepartment dDepartment) {
        return dDepartmentMapper.updateByPrimaryKeySelective(dDepartment);
    }
    //删除科室
    @Override
    public int deleteDDepartment(Integer id) {
        return dDepartmentMapper.deleteByPrimaryKey(id);
    }
}
